#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QtGui/QMainWindow>
#include <QActionGroup>
#include <QStackedLayout>
#include <QLabel>

QT_BEGIN_NAMESPACE
class Dialog;
class TestDialog;
QT_END_NAMESPACE

/** Class MainWindow. Represents the main window of the application.*/
class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = 0);
    void closeEvent(QCloseEvent *event);
    void hasChanged();
    void saved();
    Dialog* getDialog(){return dialog;};

public slots:
    void genCode();

private slots:
    bool newFile();
    bool save();
    bool saveXmlAs();
    void openXmlFile();
    void about();
    void changeMode();

private:
    bool inGenCode();
    void createActions();
    void createMenus();
    void createStatusBar();
    bool maybeSave();
    bool saveXml(QString fileName);
    void setCurrentFile(const QString &fileName);




    Dialog* dialog;
    TestDialog* testDialog;
    QString curFile;

    QMenu *fileMenu;
    QMenu *helpMenu;
    QMenu *modeMenu;

    QAction *newAct;
    QAction *openAct;
    QAction *saveXmlAct;
    QAction *saveXmlAsAct;
    QAction *genCodeAct;
    QAction *exitAct;
    QAction *aboutAct;
    QAction *aboutQtAct;
    QAction *genModeAct;
    QAction *testModeAct;
    QActionGroup *modeActGroup;

    QWidget *placeholder;
    QStackedLayout *stackedLayout;
    QLabel *modeLabel;

};

#endif // MAINWINDOW_H
